package com.example.sqlitedemo.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class MyHelper extends SQLiteOpenHelper {
    private static final String DBNAME="mydb";
    private static final int VERSION=1;
    public MyHelper(Context context){
        super(context,DBNAME,null,VERSION);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("create table product(pid INTEGER PRIMARY \n" +
                "                  KEY AUTOINCREMENT, productName VARCHAR(20), price double)");
        db.execSQL("insert into product(productName,price) values('蓝牙鼠标',55.0)");
    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {

    }
}
